package com.ordering.action.user;

import com.ordering.action.BaseAction;
import com.ordering.constant.ResultResponse;
import com.ordering.entity.Order;
import com.ordering.service.order.OrderService;
import com.ordering.service.order.impl.OrderServiceImpl;

public class OrderAction  extends BaseAction {
	
	OrderService OrderService = new OrderServiceImpl();
	
	private String itemIds;
	private Integer addrId = 100;
	private boolean status;
	private String message;
	private String remark;
	private Order order ;
	
	

	public String add(){
		ResultResponse re = new ResultResponse();
		
		try{
			if(order == null){
				order = new Order();
			}
			order.setAddrId(addrId);
			order.setRemark(remark);
			order.setUserId(getUserInfo().getId());
			re = OrderService.add(order,itemIds);
			if(re.getCode() == ResultResponse.CODE_Fail){
				throw new Exception(re.getMessage());
			}
		}catch(Exception e){
			e.printStackTrace();
			return FAIL;
		}
		return "add";
	}

    public String getItemIds()
    {
        return itemIds;
    }

    public void setItemIds(String itemIds)
    {
        this.itemIds = itemIds;
    }

    public Integer getAddrId()
    {
        return addrId;
    }

    public void setAddrId(Integer addrId)
    {
        this.addrId = addrId;
    }

    public boolean isStatus()
    {
        return status;
    }

    public void setStatus(boolean status)
    {
        this.status = status;
    }

    public String getMessage()
    {
        return message;
    }

    public void setMessage(String message)
    {
        this.message = message;
    }

    public String getRemark()
    {
        return remark;
    }

    public void setRemark(String remark)
    {
        this.remark = remark;
    }

	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}
   
	//private 
}
